#!/bin/bash

# 证书默认存储目录：/etc/letsencrypt/
# docker nginx使用方法：
# 挂载/etc/letsencrypt到容器内部
# listen 443 ssl;
# ssl_certificate /etc/letsencrypt/live/domain/fullchain.pem;
# ssl_certificate_key /etc/letsencrypt/live/domain/privkey.pem;
# 

if [ $# -ge 2 ];then
	docker run --rm -it -v /etc/letsencrypt:/etc/letsencrypt -p 80:80 certbot/certbot certonly --email $1 --agree-tos --webroot-path=/etc/letsencrypt -d $2
else
    echo "参数错误 <emall> <domain>"
fi
